package com.sangeng.controller;


import com.sangeng.annotation.SystemLog;
import com.sangeng.domain.ResponseResult;
import com.sangeng.domain.dto.RoleDto;
import com.sangeng.domain.entity.Menu;
import com.sangeng.service.RoleService;
import com.sangeng.service.TagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 角色信息表(Role)表控制层
 *
 * @author makejava
 * @since 2024-08-26 14:03:24
 */
@RestController
@RequestMapping("system/role")
public class RoleController {
    /**
     * 服务对象
     */
    @Autowired
    private RoleService roleService;

    @SystemLog(businessName = "角色列表的分页查询")
    @GetMapping("/list")
    public ResponseResult list(Long pageNum,Long pageSize,String roleName,String status){
        return  roleService.rolePageList(pageNum,pageSize,roleName,status);
    }

    @SystemLog(businessName = "角色的停启用状态")
    @PutMapping("/changeStatus")
    public ResponseResult changeStatus(@RequestBody RoleDto roleDto){
        return roleService.changeStatus(roleDto);
    }

    @SystemLog(businessName = "新增角色接口")
    @PostMapping
    public  ResponseResult addRole(@RequestBody RoleDto roleDto){
        return roleService.addRile(roleDto);
    }

    @SystemLog(businessName = "角色信息回显接口")
    @GetMapping("/{id}")
    public ResponseResult getRoleById(@PathVariable Long id){
       return roleService.getRoleById(id);
    }

    @SystemLog(businessName = "更新角色信息接口")
    @PutMapping()
    public  ResponseResult updateRole(@RequestBody RoleDto roleDto){
        return  roleService.updateRole(roleDto);
    }

    @SystemLog(businessName = "删除角色接口")
    @DeleteMapping("/{id}")
    public ResponseResult deleteRole(@PathVariable Long id){
       return roleService.deleteRole(id);
    }

    @SystemLog(businessName = "查询角色列表接口")
    @GetMapping("/listAllRole")
    public ResponseResult listAllRole(){
       return roleService.listAllRole();
    }
}

